<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page import="com.are.odisea.*"%>
<%@include file="validausuario.jsp"%>
<%
String rolp="VMEN";
if(!RolesPag.tienePermiso(rolp,(String)session.getAttribute("id_usuario"))){
	response.sendRedirect("index.jsp");	
}
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Odisea - Bandeja de Noticias</title>
	<link rel="stylesheet" href="themes/redmond/jquery.ui.all.css">
	<LINK REL="stylesheet" TYPE="text/css" HREF="main.css">
	<script src="ui/jquery-1.8.0.js" language="JavaScript"></script>
	<script src="ui/jquery.ui.core.js" language="JavaScript"></script>
	<script src="ui/jquery.ui.widget.js" language="JavaScript"></script>
	<script src="ui/jquery.ui.tabs.js" language="JavaScript"></script>
	<script src="ui/jquery.ui.button.js"></script>
	<script src="ui/jquery.effects.core.js"></script>
	<script src="ui/jquery.effects.slide.js"></script>
	<script src="ui/jquery.ui.datepicker.js"></script>
	<script src="ui/jquery.effects.explode.js"></script>
	<script src="ui/jquery.effects.fold.js"></script>
	<script src="ui/jquery.effects.slide.js"></script>
	<script src="ui/jquery.ui.draggable.js"></script>
	<script src="ui/jquery.ui.position.js"></script>
	<script src="ui/jquery.ui.resizable.js"></script>
	<script src="ui/jquery.ui.dialog.js"></script>
	<script src="ui/jquery.effects.core.js"></script>
	<script src="ui/jquery.ui.widget.js"></script>
	<script src="ui/jquery.ui.mouse.js"></script>
	<script src="ui/jquery.bgiframe-2.1.2.js"></script>
	<script type="text/javascript">
	$(function() {
		//callback function to bring a hidden box back
		function callback() {
			/*setTimeout(function() {
				$( "#effect:visible" ).removeAttr( "style" ).fadeOut();
			}, 1000 );*/
		};

		// set effect from select menu value
		$( "#FI" ).datepicker({
			showOn: "button",
			buttonImage: "images/calendar.gif",
			buttonImageOnly: true
		});
		$( "#FI" ).datepicker( "option", "showAnim", "slide" );
		$( "#FF" ).datepicker({
			showOn: "button",
			buttonImage: "images/calendar.gif",
			buttonImageOnly: true
		});
		$( "#FF" ).datepicker( "option", "showAnim", "slide" );
	});
	</script>
	
	<script type="text/javascript">
	function FiltrarMensajes() {
		var FI = $("#FI").val();
		var FF = $("#FF").val();
		var filtro = $("#criterio").val();
		if (filtro == "") {
			alert ("Faltan datos para ejecutar la consulta");
			return;
		}
		
		var isChk = $('#filtrar').is(':checked'); // return true o false
		if (isChk) {
			if (FI == "" || FF == "") {
				alert ("Faltan datos para ejecutar la consulta");
				return;
			}
			
			var url = "SrvMensajes?operacion=listFil&filtro=" + filtro + "&FI="+FI+"&FF=" + FF;
			$("#Mensajes").load(url);		
		}else {
			
			var url = "SrvMensajes?operacion=listTer&filtro=" + filtro;
			$("#Mensajes").load(url);
		}
	}
	
	
	</script>
</head>
<body onload="listTer()">
<%@include file="header.jsp"%>
<div class="contencenter demo">
	<H2><img src="images/Mensaje.png" style="width:64px; heigth:64px;" />Mensajes</H2>
	<div style="width:85%; font-size:12px;">
		<form action="" name="form1">
		<table>
		<tr>
			<td>Busqueda: <input type="text" size=40 name="criterio" id="criterio" class="text ui-widget-content ui-corner-all"/></td> 
			<td><input type="checkbox" name="filtrar" id="filtrar">Filtrar por Fecha</td>
			<td><div class="jcalendar" style="width:150px;">Desde<input type="text" class="date-pick ui-widget-content ui-corner-all" id="FI" name="FI" value="" size="10" /></div></td>
			<td><div class="jcalendar" style="width:150px;">Hasta<input type="text" class="date-pick ui-widget-content ui-corner-all" id="FF" name="FF" value="" size="10" /></div></td>
			<td><input type="button" value="Buscar" name="cmd_buscar" id="cmd_buscar" onclick="javascript:FiltrarMensajes()"></td>
		</tr>
		</table>
		</form>
	</div>
	<div id="Mensajes">
	</div>
</div>
<%@include file="foot.jsp"%>
</body>
</html>